package com.puppet.controller;

import com.puppet.pojo.Result;
import com.puppet.pojo.entity.RedisConst;
import com.puppet.pojo.vo.BookTypeVO;
import com.puppet.service.BookService;
import com.puppet.service.BookTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/bookType")
public class BookTypeController {
    @Autowired
    private BookTypeService bookTypeService;
    @GetMapping
    @Cacheable(value = RedisConst.BOOK_TYPE_LIST, keyGenerator = "keyGenerator")
    public Result<List<BookTypeVO>> getBookTypeNameAndId(){
        return Result.ok(bookTypeService.getBookTypeNameAndId());
}
}
